<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<!-- Some ideas for code or styling taken from: -->
<!-- /* http://w3schools.com/ -->
<!-- /* http://net.tutsplus.com/tutorials/html-css-techniques/design-a-prettier-web-form-with-css-3/ -->
<!-- /* http://gazpo.com/2011/02/form/ -->
<!--/* http://kalyan-city.blogspot.com/2009/11/simple-javascript-calculator-code.html--> 
<!-- /* If code was specifially cut and pasted from site that code -->
<!-- /* will have linke to source commented above it -->
	
<html lang="en">
<head>
<meta charset='utf-8' name="keywords" content="Mortgage Calculator, Free, Free Mortgage, Free Calculator, calculator">
<title> Free Mortgage Calculator </title>
<link href="sitestyle.css" rel="stylesheet">
<script src="scripts/jquery.js" language="javascript"> </script>

<script language="javascript" type="text/javascript">

function calculate() {
pp=Number(document.calculator.purchaseprice.value);
dp=Number(document.calculator.downpayment.value);
ml=Number(document.calculator.length.value);
ir=Number(document.calculator.interestrate.value);
pt=Number(document.calculator.propertytax.value);
hi=Number(document.calculator.insurance.value);
pmi=Number(document.calculator.pmi.value);

l=Number(pp-dp);
n=Number(ml*12);
t=Number(pt/12);
i=Number(hi/12);
c=Number(ir/1200);
p=Number(((pmi/100)*l)/12);

x=Number(1+c);
y=Number(Math.pow(x,n));

a=Number(c*y);
b=Number(y-1);
d=Number(a/b);

monthly=Number(l*d+p+t+i);

dec=Number(Math.round(monthly * 100) / 100).toFixed(2);

dec=dec.toString();

if (dec < 0 || !$.isNumeric(dec) || dec == null) {
alert ("The values entered would equal a nonvalid monthly payment. Please check your entries and recalculate your payment.");
return false;
}

document.output.monthly.value = dec;

}

function validate () {
pp=Number(document.calculator.purchaseprice.value);
dp=Number(document.calculator.downpayment.value);
ml=Number(document.calculator.length.value);
ir=Number(document.calculator.interestrate.value);
pt=Number(document.calculator.propertytax.value);
hi=Number(document.calculator.insurance.value);
pmi=Number(document.calculator.pmi.value);

pp=pp.toString();
dp=dp.toString();
ml=ml.toString();
ir=ir.toString();
pt=pt.toString();
hi=hi.toString();
pmi=pmi.toString();

	if (!$.isNumeric(pp) || pp == null || pp == "")
	{
		alert("Please enter a valid number for the Purchase Price of the home");
		return false;
	}
	
	if (!$.isNumeric(dp) || dp == null || dp == "")
	{
		alert("Please enter a valid number for the Down Payment entry");
		return false;
	}
	
	if (!$.isNumeric(ml) || ml == null || ml == "" || ml <=0)
	{
		alert("Please enter a valid number for the Mortgage Length entry");
		return false;
	}
	
	if (!$.isNumeric(ir) || ir > 100 || ir == null || ir == "")
	{
		alert("Please enter a valid percentage (0-100) for the Interest Rate entry");
		return false;
	}

	
	if (!$.isNumeric(pmi) || pmi > 100 || pmi == null || pmi == "")
	{
		alert("Please enter a valid percentage (0-100) for the PMI entry");
		return false;
	}
	
	if (!$.isNumeric(pt) || pt == null || pt == "")
	{
		alert("Please enter a valid number for the Property Tax entry");
		return false;
	}
	
	if (!$.isNumeric(hi) || hi == null || hi == "")
	{
		alert("Please enter a valid number for the Home Insurance entry");
		return false;
	}

calculate();
	
}

function rstform() {

document.calculator.purchaseprice.value = '';
document.calculator.purchaseprice.value = '';
document.calculator.downpayment.value = '';
document.calculator.length.value = '';
document.calculator.interestrate.value = '';
document.calculator.propertytax.value = '';
document.calculator.insurance.value = '';
document.calculator.pmi.value = '';

document.output.monthly.value = '';

}


</script>





</head>

<div id="heading">
<!--  Beginning of Heading  -->

<div id="topgraphic"> 
<a href="index.html"> <img src="images/header.gif" alt="FreeMortgageCalc.com Head Graphic"> </a>
</div>

<!-- End of Heading -->
</div>



<body id="body">
<!-- Beginning of Body -->


<div id="rightcontent">
<!--Beginning of Right Content -->

<h3> Facts and Information </h3> 
<ul id="links">
<li> <a href="http://www.ehow.com/facts_4574288_on-mortgages.html" target="_blank"> eHow - Facts About Mortgages </a> </li>
<li> <a href="http://www.approved.com/learning-center/the-facts-on-mortgages-a-home-loans.html" target="_blank"> Facts on Mortages and Home Loans </a> </li>
<li> <a href="http://homebuying.about.com/od/mortgagefacts/" target="_blank"> About.com Mortgage Advice </a> </li>
</ul>

<h3> Current Rates </h3>
<ul id="links">
<li> <a href="http://www.bankrate.com/mortgage.aspx" target="_blank"> Bankrate.com </a> </li>
<li> <a href="http://www.zillow.com/mortgage-rates/" target="_blank"> Zillow.com </a> </li>
</ul>

<h3> Lenders </h3>
<ul id="links">
<li> <a href="http://www.lendingtree.com/" target="_blannk"> Lending Tree </a> </li>
<li> <a href="http://www.quickenloans.com/" target="_blannk"> Quicken Loans </a> </li>
<li> <a href="http://www.gmacmortgage.com/" target="_blank"> GMAC Mortgage </a> </li>
<!--End of Right Content -->
</div>


<div id="centercontent">
<!-- Beginning of Content -->

<h3> Find Your Monthly Payment! </h3>

<p> Below you will find a free, easy to use mortgage calculator. Just enter in all of the 
information below and press the "Calculate My Monthly Payment" button to see the results!
</p>

<div class="calculatorform"> 
<form name="calculator" method="post">

<p class="purchase">
<label for="purchaseprice"> Home Purchase Price: </label> 
<span class="tb"> <input type="text" input maxlength="10" size="10" id="purchaseprice" name="purchaseprice" /> </span>
</p>

<p class="dp">
<label for="downpayment"> Down Payment Amount: </label>
<span class="tb"> <input type="text" input maxlength="10" size="10" id="downpayment" name="downpayment" /> </span>
</p>

<p class="length">
<label for="length"> Mortgage Length (years): </label>
<span class="tb"> <input type="text" input maxlength="2" size="10" id="length" name="length" /> </span>
</p>

<p class="interest">
<label for="interestrate"> Interest Rate (%): </label>
<span class="tb"> <input type="text" input maxlength="5" size="10" id="interestrate" name="interestrate" /> </span>
</p>

<p class="pmi">
<label for="pmi"> PMI (%): </label>
<span class="tb"> <input type="text" input maxlength="5" size="10" id="pmi" name="pmi" /> </span>
</p>

<p class="tax">
<label for="propertytax"> Property Tax (yearly): </label>
<span class="tb"> <input type="text" input maxlength="7" size="10" id="propertytax" name="propertytax" /> </span>
</p>

<p class="insurance">
<label for="insurance"> Home Insurance (yearly): </label>
<span class="tb"> <input type="text" input maxlength="7" size="10" id="insurance" /> </span>
</p>

<p class="submit">
<input type="button" class="submit" value="Calculate My Monthly Payment!" onclick="javascript:validate();"> 
</p>

</form>
</div>

<div class="outputform">
<form name="output" method="post">

<label for="monthly"> Your Monthly Payment: </label> 
<span class="tp"> $ <input type="text" class="outputtext" id="monthly" name="monthly" size="10" readonly> </span>

</form>
</div>

<div class="resetform"> 
<input type="button" class="submit" id="resetbutton" value="Clear Form" onclick="javascript:rstform();"> </span>
</div>








<!-- End of Output Table -->
</div>

<!-- End of Center Content -->
</div>



<!-- End of Body -->
</div>




</body>
</html>